var _widgets = require('../db/widgets.js');

module.exports = function(router) {

  router.get('/', function(req, res) {
    _widgets.getWidgets(req.user.id)
            .then(function(widgets){
              return res.json(widgets);
            })
            .catch(function(err){
              return res.json ({
                code: '000-0001',
                message: 'failed to get widgets:'+err
              });
            });
  });
};